<template>
  <div class="container">
    <div class="fb_banner">
      <div class="f_time abs" id="f_time">
        <div class="timer active"><FbTimeCount /></div>
        <div class="timer next_time" id="nt1"><fbTNC :thr="1" /></div>
        <div class="timer next_time" id="nt2"><fbTNC :thr="2" /></div>
        <div class="timer next_time" id="nt3"><fbTNC :thr="3" /></div>
        <div class="timer next_time" id="nt4"><fbTNC :thr="4" /></div>
      </div>
    </div>
  </div>
</template>

<script>
import FbTimeCount from "@/flash_buy/fbTimeCount";
import fbTNC from "@/flash_buy/fbTimeNextCount";
export default {
  name: "FbBanner",
  components: {
    FbTimeCount,
    fbTNC,
  },
  data() {
    return { scroll: "", tarhour: "" };
  },
  methods: {
    catScr() {
      this.scroll =
        document.documentElement.scrollTop || document.body.scrollTop;
      let f_time = document.getElementById("f_time");
      if (this.scroll < 100) {
        f_time.className = "f_time abs";
      } else f_time.className = "f_time fix";
    },
  },
  created() {
    window.addEventListener("scroll", this.catScr);
  },
};
</script>

<style lang="less" scoped>
.container {
  width: 1226px;
  margin: 0 auto;
  .fb_banner {
    background: url("~@/assets/img/fbuy/banner.webp") no-repeat center center;
    width: 100%;
    height: 170px;
    position: relative;
    color: #f5f5f5;
    .f_time {
      width: 100%;
      height: 40%;

      display: grid;
      grid-template-columns: repeat(5, 20%);
      .timer {
        height: 100%;
      }
      .active {
        background: #f1393a;
      }
    }
    .abs {
      position: absolute;
      bottom: 0;
    }
    .fix {
      position: fixed;
      z-index: 999;
      width: 1226px;
      height: 68px;
      top: 0;
    }
    .next_time {
      background: #414141;
    }
  }
}
</style>